import { config } from '../config.js';
import { HomeModel } from '../../../modules/home.js';

const home = new HomeModel();

Page({
  data: {
    comp: null,
    imagesUrl: [],
    enterprise: {
      name: config.enterprise.name,
      scale: config.enterprise.scale,
      field: config.enterprise.field,
      image: config.enterprise.image,
      examineName: config.enterprise.examineName
    },
    loading: false
  },
  // 查看图片
  viewImage: function (e) {
    wx.previewImage({
      current: e.target.dataset.src,
      urls: this.data.imagesUrl,
    });
  },
  onLoad: function (options) {
    home.compInfo()
    .then(res => {
      if(res.code == 2) {
        let img = res.data.comp.photo;
        this.setData({
          comp: res.data.comp,
          imagesUrl: img.split(','),
          loading: true
        });
      }
    })
  }
})